<template>
  <view class="api-page">
    <!-- 页面头部 -->
    <view class="page-header">
      <text class="header-title">API 功能演示</text>
      <text class="header-desc">常用功能快速导航</text>
    </view>
    
    <!-- 功能卡片网格布局 -->
    <view class="api-grid">
      <!-- 打印日志卡片 -->
      <navigator url="/pages/APIpages/LogPage/LogPage" class="api-card">
        <view class="card-icon log-icon">📋</view>
        <view class="card-content">
          <text class="card-title">打印日志</text>
          <text class="card-desc">日志输出与查看</text>
        </view>
        <view class="card-arrow">→</view>
      </navigator>
      
      <!-- 计时器卡片 -->
      <navigator url="/pages/APIpages/TimerPage/TimerPage" class="api-card">
        <view class="card-icon timer-icon">⏱️</view>
        <view class="card-content">
          <text class="card-title">计时器</text>
          <text class="card-desc">setTimeout & setInterval</text>
        </view>
        <view class="card-arrow">→</view>
      </navigator>
      
      <!-- 数据缓存卡片 -->
      <navigator url="/pages/APIpages/StoragePage/StoragePage" class="api-card">
        <view class="card-icon storage-icon">💾</view>
        <view class="card-content">
          <text class="card-title">数据缓存</text>
          <text class="card-desc">本地存储操作演示</text>
        </view>
        <view class="card-arrow">→</view>
      </navigator>
    </view>
    
    <!-- 装饰元素 -->
    <view class="bg-decoration"></view>
  </view>
</template>

<script>
export default {
  data() {
    return {};
  },
  methods: {}
};
</script>

<style scoped>
/* 页面全局样式 */
.api-page {
  min-height: 100vh;
  background-color: #f5f7fa;
  padding: 30rpx 20rpx;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

/* 背景装饰 */
.bg-decoration {
  position: absolute;
  top: -150rpx;
  right: -150rpx;
  width: 400rpx;
  height: 400rpx;
  background: linear-gradient(135deg, rgba(66, 153, 225, 0.05), rgba(159, 122, 234, 0.05));
  border-radius: 50%;
  filter: blur(80rpx);
  z-index: 0;
}

/* 页面头部 */
.page-header {
  text-align: center;
  margin-bottom: 50rpx;
  position: relative;
  z-index: 1;
}

.header-title {
  font-size: 38rpx;
  font-weight: 600;
  color: #2d3748;
  display: block;
  margin-bottom: 12rpx;
  letter-spacing: 1rpx;
}

.header-desc {
  font-size: 24rpx;
  color: #718096;
}

/* 网格布局 */
.api-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 25rpx;
  position: relative;
  z-index: 1;
}

/* 功能卡片样式 */
.api-card {
  display: flex;
  align-items: center;
  background-color: #ffffff;
  border-radius: 18rpx;
  padding: 30rpx;
  box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  text-decoration: none;
  overflow: hidden;
  position: relative;
}

/* 卡片hover效果 */
.api-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 6rpx;
  height: 100%;
  background: linear-gradient(180deg, #4299e1, #9f7aea);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.api-card:hover {
  transform: translateY(-4rpx);
  box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
}

.api-card:hover::before {
  opacity: 1;
}

/* 卡片图标 */
.card-icon {
  font-size: 50rpx;
  width: 80rpx;
  height: 80rpx;
  border-radius: 14rpx;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 25rpx;
  flex-shrink: 0;
}

.log-icon {
  background-color: #e8f4f8;
  color: #4299e1;
}

.timer-icon {
  background-color: #fdf2f8;
  color: #9f7aea;
}

.storage-icon {
  background-color: #eaf6fa;
  color: #38b2ac;
}

/* 卡片内容区 */
.card-content {
  flex: 1;
}

.card-title {
  font-size: 30rpx;
  font-weight: 500;
  color: #2d3748;
  display: block;
  margin-bottom: 6rpx;
}

.card-desc {
  font-size: 22rpx;
  color: #718096;
  line-height: 1.4;
}

/* 箭头图标 */
.card-arrow {
  font-size: 28rpx;
  color: #cbd5e0;
  transition: all 0.3s ease;
}

.api-card:hover .card-arrow {
  color: #4299e1;
  transform: translateX(6rpx);
}

/* 响应式调整：大屏幕横向排列 */
@media (min-width: 768px) {
  .api-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 800rpx;
    margin: 0 auto;
  }
}

@media (min-width: 1024px) {
  .api-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 1200rpx;
  }
}
</style>